The present invention generally relates to psuedo-random number generators (PRNGs), and more particularly relates to systems, such as private-key stream cipher cryptosystems, which employ linear feedback shift registers to produce pseudo-random bit keystreams, such as keystreams for combining with plaintext to encrypt the plaintext into ciphertext and keystreams for combining with the ciphertext to decipher the ciphertext into plaintext.
Pseudo-random number generators (PRNGs) are used in a variety of systems such as cryptosystems, Monte Carlo simulation systems, games, and heuristic design systems (e.g., gate array placement and routing systems). In particular, cryptosystems perform cryptography to transform plaintext into ciphertext so that only an authorized receiver can transform the ciphertext back into the original plaintext. Encryption or enciphering is the process that transforms plaintext into ciphertext. Decryption or deciphering is the process that transforms ciphertext into plaintext.
A parameter called an encryption key is employed by a cryptosystem to prevent the plaintext from being easily revealed by an unauthorized person. A sender transforms a given plaintext into a large variety of possible ciphertexts selected by the specific encryption key. A receiver of the ciphertext deciphers the ciphertext by employing a parameter referred to as a decryption key. In a public-key cryptosystem, the encryption key is made public while the decryption key is kept secret. Therefore, in public key cryptosystems, the decryption key must be computationally infeasible to deduce from the encryption key. In a private-key cryptosystem, the sender and the receiver typically share a common key that is used for both enciphering and deciphering. In such a private-key cryptosystem, the common key is alterable and must be kept secret.
Private-key cryptosystems are typically implemented as block cipher cryptosystems or stream cipher cryptosystems. Block cipher cryptosystems divide the plaintext into blocks and encipher each block independently using a stateless transform. In block cipher cryptosystems if one fixed common private-key is employed to encipher different occurrences of a particular plaintext block, all of these occurrences are encrypted into identical corresponding ciphertext blocks. Therefore, the block size is preferably selected to be large enough to frustrate attacks from a cryptanalyst, which analyzes the occurrence frequencies of various patterns among the ciphertext blocks. Example block sizes are 64 bits and 128 bits.
In stream cipher cryptosystems, the plaintext is typically encrypted on a word-by-word basis using a stateful transform that evolves as the encryption progresses. In encrypting the plaintext binary data sequence for transmission as a ciphertext binary data sequence, the common private-key is a parameter that controls a pseudo-random bit generator to create a long sequence of binary data referred to as a keystream. The stream cipher cryptosystem includes a cryptographic combiner, which combines the keystream with the plaintext sequence. The cryptographic combiner is typically implemented with exclusive-or (XOR) bit-wise logic functions, which perform bit-wise modulo-2 addition. The cryptographic combiner produces the ciphertext. At the receiver, the common private-key controls a receiver pseudo-random bit generator to produce a decryption keystream. The decryption keystream is combined with a decryption combiner to decrypt the ciphertext to provide the plaintext to the receiver. The receiver decryption combiner operation must be the inverse of the sender encryption combiner operation. For this reason, the most common combiner operation is bit-wise XOR, which is its own inverse.
One problem with stream cipher cryptosystems is the difficulty of generating a long, statistically uniform, and unpredictable sequence of binary data in the keystream from a short and random key. Such sequences are desirable in the keystream in cryptography to make it impossible, given a reasonable segment of its data and sufficient computer resources, to find out more about the sequences.
There are four general requirements for cryptographically secure keystream PRNGs. First, the period of a keystream must be large enough to accommodate the length of the transmitted message. Second, the keystream output bits must have good statistical properties (e.g. values are uniformally distributed). Third, the keystream output bits must be easy to generate. Fourth, the keystream output bits must be hard to predict. For example, given the PRNG and the first N output bits, a(0), a(1), . . . , a(Nxe2x88x921), it should be computationally infeasible to predict the (N+1)th bit a(N) in a sequence with better than a 50xe2x80x9450 chance. In otherwords, a cryptanalyst should not be able to generate other forward bits or backward bits if presented with a given portion of the keystream output sequence.
The PRNG employed in stream cipher cryptosystems, often employs a feedback shift register (FSR) which includes N storage elements and a feedback function that expresses each new element a(t) of the sequence in terms of the previous generated elements a(txe2x88x92N), a(txe2x88x92N+1), . . . , a(txe2x88x921). Each individual storage element of the FSR is called a stage, and the binary signals a(0), a(1), a(2), . . . , a(Nxe2x88x921) are loaded into the stages as initial data to generate the keystream sequence. The period of the keystream sequence produced by the FSR depends both on the number of stages and on the details of the feedback function. The maximal period of a keystream sequence generated by an N-stage FSR with a non-singular feedback function is 2N, which represents the number of possible states of the N-stage FSR.
Depending on whether the feedback function is linear or is non-linear, the FSR is referred to respectively as a linear feedback shift register (LFSR) or a non-linear feedback shift register (NLFSR).
In particular, the LFSR is employed in many pseudo-random bit generators for stream cipher cryptosystems. LFSRs are preferred over most other PRNGs because mathematics are available to design LFSRs with guaranteed long sequence length and good statistics. The LFSR feedback function is of the form a(t)=c1 a(txe2x88x921) XOR c2 a(txe2x88x922) XOR . . . XOR cNxe2x88x921 a(txe2x88x92N+1) XOR nN a(txe2x88x92N), where ci is an element of the set {0,1}. Each stage that is associated with a non-zero ci is referred to as a tap. The feedback function of an LFSR can be represented formally by what is referred to as a feedback polynomial:
f(x)=1+c1x+c2xNxe2x88x922+. . . +cNxe2x88x921xNxe2x88x921+cNxN
where the intermediate x has no other meaning than as a mathematical symbol. This feedback polynomial decides the period and the statistical behavior of the keystream output sequence. To avoid trivial output, the zero-state should be excluded from the initial setting. This limits the largest possible period of an LFSR to 2Nxe2x88x921
In general, to generate the largest possible period 2Nxe2x88x921 for the output sequence, the feedback polynomial f(x) of the LFSR should be primitive. A sequence generated by an LFSR with a primitive feedback polynomial is referred to as a maximal-length LFSR sequence or simply an m-sequence. However, m-sequences cannot be used as keystreams without undergoing further cryptographic transformation. Without this further cryptographic transformation, the key of secrecy (i.e, the initial state of the LFSR and the feedback function of the LFSR) of an N-stage LFSR can be determined from just 2N successive bits of the output sequence.
Efficient synthesis procedures exist for finding feedback polynomials of the shortest LFSR that would generate a given output sequence. The length of such an LFSR is referred to as the linear complexity of the sequence. As a result, an LFSR suitable for employment in a cryptosystem, must guarantee a large enough key-independent lower bound to the linear complexity of the sequences the LFSR generates.
Conventional LFSRs implemented in software are particularly slow, because a relatively large number of instructions need to be executed to obtain each new one bit element a(t) and to shift the new element a(t) into the LFSR by shifting each bit of the LFSR to the left or right depending on the implementation of the LFSR. A detailed example of this problem with conventional LFSRs is provided in the Description of the Preferred Embodiment section of the present specification.
Because LFSRs implemented in software are very slow, various techniques have been attempted to speed-up the software implemented LFSR. For example, a matrix multiply has been used to advance an LFSR by multiple bits. Another speed-up technique is to run parallel LFSRs. However, parallel LFSRs are slow to initialize and occupy many times more memory than the equivalent serial implementation. None of the conventional speed-up techniques provide a significant time reduction in implementing an LFSR in software.
For reasons stated above and for other reasons presented in greater detail in the Description of the Preferred Embodiments section of the present specification, a PRNG is desired which uses an LFSR implemented in software and which is significantly faster than the conventional speed-up techniques used for LFSRs which generate pseudo-random numbers.
The present invention provides a pseudo-random number generator (PRNG) that includes a linear feedback shift register (LFSR) having a state. The LFSR includes N storage elements (stages) storing N bits of binary data, which are separated into w words having word length M. T tap sources provide binary data from the stages. Each tap source has a number of bits, which is a multiple of M, taken from contiguous LFSR stages beginning or ending on a stage that is a multiple of M. The LFSR also includes a linear feedback function coupled to the T tap sources and providing a temporary value, having a number of bits which is a multiple of M, which is a linear function of the binary data provided from the T tap sources. The LFSR state is advanced by shifting the binary data in the storage elements by a multiple of M bits and providing the temporary value to fill in storage elements that would otherwise be empty from the shifting. Thus, each advance of the LFSR produces a multiple of M new bits in the PRNG sequence.
One bit of each tap source is a tap bit. This tap bit is the most significant bit if the LFSR is left shifted or the least significant bit if the LFSR is right shifted.
In one embodiment of the PRNG, the LFSR is implemented in software. In another embodiment, the LFSR is implemented in hardware. In one embodiment of the software implementation of the LFSR, the LFSR is implemented in a computer system which accesses more than one computer word size, where each computer word size includes M bits. In one embodiment of the software implementation of the LFSR, register or location renaming is used instead of movement of words for the shift the binary data in the storage elements by a multiple of M bits.
In one embodiment, N is one less than a multiple of the M (e.g., N=127 or N=159 where M=32 bits). For this reason, in an embodiment where the LFSR is left shifted in response to each clock pulse, the least significant bit of the least significant LFSR word is a zero. The LFSR can also be embodied in a right shifting LFSR.
In one embodiment, for each LFSR state advancement, the temporary value is left shifted by one bit with a zero shifted into the least significant bit and then stored in the least significant LFSR word. The lost bit resulting from the temporary value being left shifted by one bit is stored in a carry-flag. Subsequently, the carry-flag is stored in the least significant bit of the second least significant LFSR word, to replace the least significant bit that had been zeroed by the left shift of the temporary value in the previous iteration. In one form of this embodiment, the storage of the carry-flag in the least significant bit of the second least significant LFSR word is accomplished by adding the carry-flag to the word with an ADD WITH CARRY instruction.
One form of a stream cipher cryptosystem according to the present invention includes a PRNG receiving a key and providing a keystream. The PRNG includes a word-by-word shifting LFSR according to the present invention for providing a LFSR output word of word length M. The stream cipher cryptosystem also includes a cryptographic combiner for combining a first binary data sequence and the keystream to provide a second binary data sequence. In encryption operations, the cryptographic combiner is an encryption combiner and the first binary data sequence is a plaintext binary data sequence and the second binary data sequence is a ciphertext binary data sequence. In decryption operations, the cryptographic combiner is a decryption combiner and the first binary data sequence is a ciphertext binary data sequence and the second binary data sequence is a plaintext binary data sequence.
The PRNG according to the present invention includes a word-by-word shifting LFSR, which can be implemented in software significantly faster than the conventional speed-up techniques used for LFSRs which generate pseudo-random numbers.